#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> num(n);
    vector<bool> flag(n, true);
    for (int i=0; i<n; ++i)
    {
        cin >> num[i];
    }

    int ans = 0;
        for (int j=0; j<n; ++j)
            for (int k=j+1; k<n; ++k)
                for (int i=0; i<n; ++i)
            {
                if (flag[i] && num[i] == num[j]+num[k])
                    {++ans; flag[i] = false;}
            }
    cout << ans;
    return 0;
}
